escape time algorithm in python